package com.east.utils;

import java.io.UnsupportedEncodingException;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.apache.tomcat.util.codec.binary.Base64;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.east.bean.User;

public class BaseUtil {
			public static User Token() {
				Subject subject = SecurityUtils.getSubject();
				System.out.println(JSON.toJSON(subject.getPrincipal()));
				 String user=(String)subject.getPrincipal();
			        byte[] decodeBase64 = Base64.decodeBase64(user);
			        String string=null;
					try {
						string = new String(decodeBase64,"UTF-8");
					} catch (UnsupportedEncodingException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
					 return JSON.parseObject(string,new TypeReference<User>() {});
			}
			
}
